package com.soft.hwx.scdapp.msg;


/*
    工作指令下发

    自检正常
    55 aa 1C B1 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D0
    正在自检
    55 aa 1C A1 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0
    自检故障
    55 aa 1C F1 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
    设备自检
    55 aa 1C 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1F

    通用于：自检，搜索，放弃搜索指令
 */
public class HostWorkMsg extends RawMsg {

    public HostWorkMsg(short workCmd,byte [] buf){
        super(buf,0x20);
        this.workCmd = workCmd;
        length = 0x20 -4;
    }

    /*
    public HostWorkMsg(RawMsg msg){
        super(msg.getBuf(),0x1C);
        length = 0x1C -4;
        this.workCmd = msg.workCmd;
        Log.d("HostWorkMsg", "HostWorkMsg构造函数");
    }*/

    @Override
    public void ToBuf(){

        //workcmd
        buf[2] = length;

        buf[3] = (byte) (workCmd >> 8);
        buf[4] = (byte) (workCmd & 0x00FF);
        //
        buf[5] = (byte) ((sn & 0xFF000000)>> 24);
        buf[6] = (byte) ((sn & 0x00FF0000)>> 16);
        buf[7] = (byte) ((sn & 0x0000FF00)>> 8);
        buf[8] = (byte) ((sn & 0x000000FF));

        super.ToBuf();
    }

}
